﻿// Jinx AJAX Framework
// Copyright (C) 2008 Blake Hegerle
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Reflection;

using Jinx;
using Jinx.Models.Sequences;
using Jinx.Communications.Applications.Services;
using Jinx.Communications.Hosting;
using Jinx.Naming;
using Jinx.Controllers;
using Jinx.Communications;
using Jinx.Applications;
using Jinx.Utility;
using Jinx.Communications.Applications;
using Jinx.Models.Prototyping;

using TestFramework.UnitTests.Hosting;
using TestFramework.UnitTests.Bindings;
using TestFramework.UnitTests.Models;
using TestFramework.UnitTests;
using TestFramework.UnitTests.Communications;
using TestFramework.UnitTests.Services;
using TestFramework.UnitTests.Applications;

namespace TestFramework
{
    public interface IModel
    {
        string Name { get; set; }
    }

    public class Controller : IController
    {
        public Controller()
        {
            Model = App.New<IModel>("Model");
        }

        [Operation]
        public void Bar()
        {
            Model.Name = "Hello, world!";
        }

        private IModel Model;
    }

#if false 
    class Program
    {
        static void Main(string[] args)
        {
            ContextualServer.CONTENT_TYPE = "text/plain";

            try
            {
                using (Terminal.Start<Controller>(Host.HOST_WILDCARD, 80, "spun", "Foo"))
                    Console.ReadLine();
            }
            catch (CompilationErrorBase e)
            {
                Console.WriteLine("Compilation error");
                Console.WriteLine();

                foreach (var Error in e.Errors)
                    Console.WriteLine(Error.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
    }
#endif
}
